FUNCTION

get_auth_handler

function get_auth_handler(op_name: text): _auth_handler

Finds the auth handler for the provided operation name among all the auth handlers defined in this dapp as extensions of auth_handler.

All auth handlers will be in a map<scope: text, _auth_handler>

A scope can be:

  • an operation name, in the way it is called from the client: a.b.my_op
  • an operation name prefixed with OVERRIDE_PREFIX: OVERRIDE_PREFIX + "a.b.my_op"
  • a mount point: a.b
  • the value of APP_SCOPE

When calling an operation, the auth handler that will be used is (in this order):

  • the auth handler with the operation name as scope, if it exists
  • the auth handler with the operation name and OVERRIDE_PREFIX as scope, if it exists
  • the auth handler with the closest mount point as scope, if it exists
  • the auth handler with the app scope, if it exists

For example, an operation mounted on a.b.my_op will look for, in this order:

  • the auth handler with scope a.b.my_op
  • the auth handler with scope OVERRIDE_PREFIX + "a.b.my_op"
  • the auth handler with scope a.b
  • the auth handler with scope a
  • the auth handler with the app scope

Throws if op_name is not valid

Throws "MISSING HANDLER" if no auth handler is defined for this operation, nor any mount point above it.

Parameters

  • op_name — the name of the operation
© 2024 Chromia